﻿<Page x:Class="VRacer.Pages.Editor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:VRacer"
      xmlns:common="clr-namespace:VRacer;assembly=VRacer"
    Title="Editor" Name="Root" DataContext="{Binding Source={x:Static common:TracksCollection.Tracks}}">
    <StackPanel>

        <GroupBox Header="1. Select track">
            <StackPanel>
                <!--<GroupBox>
                    <GroupBox.Header>
                        <RadioButton Name="_newTrackMode" GroupName="editMode" Checked="NewTrackMode_Checked">Create new track</RadioButton>
                    </GroupBox.Header>
                </GroupBox>
                <GroupBox>
                    <GroupBox.Header>
                        <RadioButton GroupName="editMode" Checked="ExistingTrackMode_Checked">Edit existing track</RadioButton>
                    </GroupBox.Header>
                </GroupBox>-->
                <ComboBox Name="_trackSelector" ItemsSource="{Binding}" SelectionChanged="_trackSelector_SelectionChanged" />
            </StackPanel>
        </GroupBox>
        <StackPanel  DataContext="{Binding ElementName=_trackSelector, Path=SelectedValue}">
            <!-- image selection -->
            <GroupBox Header="2. Enter basic informations">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="23" />
                        <RowDefinition Height="23" />
                    </Grid.RowDefinitions>

                    <!--<Label Grid.Row="0">Width</Label>
                    <Label Grid.Row="1">Height</Label>-->
                    <Label Grid.Row="2">ID</Label>
                    <Label Grid.Row="3">Title</Label>

                    <!--<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Width}" />
                    <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Height}" />-->
                    <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding ID}" />
                    <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Title}" />
                </Grid>
            </GroupBox>

            <GroupBox Header="3. Select images">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="23" />
                        <RowDefinition Height="23" />
                        <RowDefinition MaxHeight="200" />
                        <RowDefinition Height="23" />
                    </Grid.RowDefinitions>

                    <Label Grid.Column="0" Grid.Row="0">Mask</Label>
                    <Label Grid.Column="1" Grid.Row="0">Background</Label>

                    <TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding MaskFile}" />
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding BackgroundFile}" />

                    <Image Height="150" Grid.Column="0" Grid.Row="2" Source="{Binding Mask}" />
                    <Image Height="150" Grid.Column="1" Grid.Row="2" Source="{Binding Background}" />

                    <Button Click="ButtonLoadMask_Click" Grid.Column="0" Grid.Row="3">Load mask</Button>
                    <Button Click="ButtonLoadBackground_Click" Grid.Column="1" Grid.Row="3">Load background</Button>
                </Grid>
            </GroupBox>
            <Border>
                <Button Click="Button_Click">Save</Button>
            </Border>
        </StackPanel>
    </StackPanel>
</Page>
